package cn.xgj.sfzy.service.impl;

import cn.xgj.sfzy.entity.Commonweal;
import cn.xgj.sfzy.mapper.CommonwealMapper;
import cn.xgj.sfzy.service.CommonwealService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName CommonwealServiceImpl
 * @Description TODO
 * @Author 李政阳
 * @Date 2024年10月25日 11:18
 * @Version 1.0
 */
@Service
public class CommonwealServiceImpl implements CommonwealService {

    @Autowired
    private CommonwealMapper mapper;

    @Override
    public int add(Commonweal commonweal) {
        return mapper.add(commonweal);
    }

    @Override
    public int delete(Integer id) {
        return mapper.delete(id);
    }

    @Override
    public int update(Commonweal commonweal) {
        return mapper.update(commonweal);
    }

    @Override
    public PageInfo<Commonweal> findByPage(Integer pageNum, Integer pageSize, Commonweal commonweal) {
        PageHelper.startPage(pageNum,pageSize);
        List<Commonweal> list = mapper.findAll(commonweal);
        PageInfo<Commonweal> info = new PageInfo<Commonweal>(list);
        return info;
    }
}
